package smedi.ismedi.web.bff.controller.report;

import com.smedi.ismedi.report.api.feign.RemoteReportLaborFeignApi;
import com.smedi.ismedi.report.api.model.ReportOutsourcing;
import com.smedi.ismedi.report.api.model.request.ReportLaborRequest;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = {"资料管理-外分包劳务人员"})
@RequestMapping(value = "/webbff/v1/labor")
@RestController
public class RemoteReportLaborController {

    @Autowired
    RemoteReportLaborFeignApi remoteReportLaborFeignApi;

    @ApiOperation(value = "新增外分包情况", nickname = "新增外分包情况")
    @PostMapping("/add")
    public ResponseData<String> add(@RequestBody List<ReportOutsourcing> list){
        return remoteReportLaborFeignApi.add(list);
    }

    @ApiOperation(value = "外分包队伍明细情况", nickname = "根据项目id查询外分包队伍明细情况")
    @GetMapping("/list/{projectId}")
    public ResponseData<List<ReportOutsourcing>> getListByProjectId(@PathVariable("projectId") Long projectId){
        return remoteReportLaborFeignApi.getListByProjectId(projectId);
    }

    @ApiOperation(value = "现场用工人数", nickname = "现场用工人数")
    @PostMapping("/total")
    public ResponseData<Map<String, String>> laborTotal(@RequestBody ReportLaborRequest request){
        return remoteReportLaborFeignApi.laborTotal(request);
    }
}
